Skip to content

Auto-compute dist_version from CPython source instead of requiring manual input#17

Merged
m-aciek merged 4 commits intomainfrom
copilot/remove-manual-dist-version-input
Apr 8, 2026
Merged

Auto-compute dist_version from CPython source instead of requiring manual input#17
m-aciek merged 4 commits intomainfrom
copilot/remove-manual-dist-version-input

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

  • Identify stale dist_version reference in schedule.yaml
  • Remove dist_version: ${{ matrix.version }} from the build job's with: block in schedule.yaml
Original prompt

Goal

Remove the manual dist_version workflow input and instead fetch/compute it automatically from the checked out CPython source tree.

Context

Repository: m-aciek/python-docs-offline
Workflow: .github/workflows/build.yaml
Currently the workflow takes an input named dist_version (described as compatible with patchlevel.py output) and uses it to name and locate artifacts, e.g. python-${{ inputs.dist_version }}-docs-html.zip and ./Doc/dist/python-${{ inputs.dist_version }}*-docs-html.zip.

The correct dist version can be obtained by running (from the CPython checkout) in the Doc directory:

python tools/extensions/patchlevel.py --short

Requirements

  1. Remove dist_version as an input from both workflow_dispatch and workflow_call in .github/workflows/build.yaml.
  2. Add a step early in the jobs to compute dist_version automatically after checking out the CPython repository, by running python tools/extensions/patchlevel.py --short with working-directory: ./Doc.
  3. Expose the computed value in a way that all subsequent steps in the job can use it (e.g., via step outputs and/or environment variables).
  4. Replace all references to ${{ inputs.dist_version }} with the computed value across all jobs (build-html, build-text, build-texinfo, build-epub, build-pdf, and any other job in the workflow).
  5. Ensure artifact names and paths continue to match the produced files in ./Doc/dist/.
  6. In the publish job, ensure paths and naming remain correct, and that any directory structure (e.g. _site/3/) is either:
    • left as-is if intentionally constant, or
    • updated to use the computed version if appropriate; choose the most sensible approach and document the decision in the PR description.
  7. Keep the workflow readable and avoid duplication:
    • Prefer a single reusable mechanism to compute and reuse dist_version.
    • Consider using a small "prepare" job that outputs the version for other jobs (via job outputs) if needed, or a composite action, or repeating a short step per job if job outputs aren’t practical.
  8. Update any README/documentation that references providing dist_version manually.

Acceptance Criteria

  • Workflow can be manually dispatched without requiring dist_version.
  • Workflow can be called via workflow_call without requiring dist_version.
  • All build jobs successfully upload artifacts with correct names and glob paths.
  • No remaining references to inputs.dist_version.

Notes

  • Use the computed version exactly as printed by patchlevel.py --short.
  • Make sure to trim whitespace/newlines when capturing the value.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Use python tools/extensions/patchlevel.py --short in Doc directory to get the dist_version

Assistant: To get the dist_version, run this from the CPython repo’s Doc/ directory (the docs build directory):

cd Doc
python tools/extensions/patchlevel.py --short

Use the command’s output (e.g., 3.14) as the dist_version input for your workflow in m-aciek/python-docs-offline (see .github/workflows/build.yaml where dist_version is described as “compatible with patchlevel.py output”).

User: create a pull request: remove the input argument replacing it with fetching it automatically

Assistant: I’m waiting for you to accept the pull request tool action in the dialog; once you confirm, I’ll proceed to implement the change and open the PR in m-aciek/python-docs-offline.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Remove manual dist_version workflow input and compute automatically Auto-compute dist_version from CPython source instead of requiring manual input Apr 8, 2026
Copilot AI requested a review from m-aciek April 8, 2026 23:24
@m-aciek m-aciek marked this pull request as ready for review April 8, 2026 23:46
@m-aciek m-aciek merged commit 3a2b247 into main Apr 8, 2026
41 checks passed
@m-aciek m-aciek deleted the copilot/remove-manual-dist-version-input branch April 8, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants